import { useEffect, useRef, useState } from "react";
// import { Calendar } from "./components/Calendar";
import Calendar, { CalendarRef } from "./components/Calendar2";

function App() {
  const [value, setValue] = useState(new Date("2024-5-1"));
  const calendarRef = useRef<CalendarRef>(null);

  useEffect(() => {
    console.log(calendarRef.current?.getDate().toLocaleDateString());

    setTimeout(() => {
      calendarRef.current?.setDate(new Date(2024, 3, 1));
    }, 3000);
  }, []);
  // return (
  //   <Calendar value={value} onChange={(date) => {
  //     console.log(date.toLocaleDateString());
  //     setValue(date);
  //   }}/>

  // );
  // return <Calendar defaultValue={new Date('2024-5-1')} onChange={(date) => {
  //   console.log(date.toLocaleDateString());
  // }}/>
  return (
    <Calendar
      onChange={(date) => console.log(date.toLocaleDateString())}
      ref={calendarRef}
    />
  );
}

export default App;
